package day18;

import java.io.FileReader;
import java.io.IOException;


/**
 * 将一个.java文件读取到控制台上
 * @author wangbiao
 *
 */
public class FileReaderTest {

	public static void main(String[] args) {
		FileReader fr = null;
		try {
			fr = new FileReader(
					"D:\\MyProject\\javatest\\src\\day18\\DateFormatDemo.java");
			char[] chs = new char[1024];
			int len = 0;
			while ((len=fr.read(chs)) != -1) {
				System.out.print(new String(chs,0,len));
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (null != fr) {
				try {
					fr.close();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}
	}
}
